package com.shrct.businessprocess.budget;

import com.shrct.businessprocess.budget.RCBudget;
import com.shrct.businessprocess.budget.impl.RCBudgetImpl;
import edu.fudan.mylang.common.NumberExtensions;
import edu.fudan.mylang.pf.BaseDataType;
import javax.persistence.CascadeType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

public class RCCost4RemainItem extends BaseDataType {
  public RCCost4RemainItem() {
    super();
  }
  
  @JoinColumn(name = "budget_id")
  @ManyToOne(targetEntity = RCBudgetImpl.class, cascade = { CascadeType.MERGE, CascadeType.PERSIST })
  private RCBudget budget;
  
  public RCBudget getBudget() {
    return this.budget;
  }
  
  public RCCost4RemainItem setBudget(final RCBudget budget) {
    this.budget = budget;
    return this;			
    
  }
  
  private String title;
  
  public String getTitle() {
    return this.title;
  }
  
  public RCCost4RemainItem setTitle(final String title) {
    this.title = title;
    return this;			
    
  }
  
  private Double amount;
  
  public Double getAmount() {
    return this.amount;
  }
  
  public RCCost4RemainItem setAmount(final Double amount) {
    this.amount = amount;
    return this;			
    
  }
  
  private Double taxRate;
  
  public Double getTaxRate() {
    return this.taxRate;
  }
  
  public RCCost4RemainItem setTaxRate(final Double taxRate) {
    this.taxRate = taxRate;
    return this;			
    
  }
  
  public Double getTax() {
    Double _nullsafe = NumberExtensions.nullsafe(this.taxRate);
    double _divide = ((_nullsafe).doubleValue() / 100);
    double _plus = (1 + _divide);
    double _divide_1 = ((this.amount).doubleValue() / _plus);
    Double _nullsafe_1 = NumberExtensions.nullsafe(this.taxRate);
    double _multiply = (_divide_1 * (_nullsafe_1).doubleValue());
    double _divide_2 = (_multiply / 100);
    return Double.valueOf(_divide_2);
  }
  
  public static RCCost4RemainItem create() {
    return new RCCost4RemainItem();
    
    
  }
}
